package GUI;

import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.ArrayList;
import java.util.Arrays;

import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPasswordField;
import javax.swing.JTextField;

import Client.Client;

public class ShowFrame extends JFrame implements ActionListener {
	ArrayList<String> list = new ArrayList<String>();
	// Variabelbös
	String doctor, nurse, patient, comment,patientID;
	Client client;

	public ShowFrame(Client client, String dataString) {
		super("Edit journal");

		String[] temp;
		String delimiter = "#";
		temp = dataString.split(delimiter);


		doctor = temp[0];
		nurse = temp[1];
		comment = temp[2];
		patient = temp[3];
		patientID = temp[4];

		setVisible(true);
		this.setSize(500, 100);
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		this.client = client;

		setLayout(new GridLayout(6, 2));

		// lägg till bös i listan;

		
		add(new JLabel("Doctor"));
		add(new JLabel(doctor));
		

		add(new JLabel("Nurse:"));
		add(new JLabel(nurse));
		
		
		add(new JLabel("Patient:"));
		add(new JLabel(patient));

		
		add(new JLabel("PatientID"));
		add(new JLabel(patientID));
		
		
		add(new JLabel("Comment:"));
		add(new JLabel(comment));

		
		add(new JLabel(""));
		JButton button = new JButton("Exit");
		add(button);

		pack();

		button.addActionListener(this);

	}

	@Override
	public void actionPerformed(ActionEvent e) {
		new JournalFrame(client);
		this.setVisible(false);
	}

	public void warningMessage(String s) {
		System.out.print(s);
	}
}